// OGoMojo
// Whitemice.MOGI.RPC2.Enterprise
// License: LGPL
// Copyright: Whitemice Consulting, 2006
// Author(s): Adam Tauno Williams (awilliam@whitemice.org)
using System;
using System.Globalization;
using Whitemice.MOGI;
using CookComputing.XmlRpc;

namespace Whitemice.MOGI.RPC2 
{
	/// \brief Implementation of IEnterperise
	public class Enterprise : Whitemice.MOGI.RPC2.Company, IEnterprise 
	{
		/// \brief Constructor
		/// \param document An XmlRpcStruct document
		/// \param server Reference to server object		
		public Enterprise(XmlRpcStruct document, Server server)
		 : base(document, server) 
		{
		}
		
		/// \brief Returns the unique name of the object		
		public override string Name 
		{
			get 
			{
				return ("Document/Enterprise/" + Number);
			}
		}

		/// \brief Accessor for the name value		
		public string Description 
		{ 
			get 
			{
				if (document.ContainsKey("name"))
					return (string)document["name"];
				return "";
			}
			set 
			{
				if (document.ContainsKey("name"))
					document["name"] = value;
					else document.Add("name", value);
			}
		}
		
		/// \brief Accessor for the bank value
		public string Bank 
		{
			get 
			{
				if (document.ContainsKey("bank"))
					return (string)document["bank"];
				return "";
			}
			set 
			{
				if (document.ContainsKey("bank"))
					document["bank"] = value;
					else document.Add("bank", value);
			}
		}
		
		/// \brief Accessor for the bankCode value
		public string BankCode 
		{ 
			get 
			{
				if (document.ContainsKey("bankCode"))
					return (string)document["bankCode"];
				return "";
			}
			set 
			{
				if (document.ContainsKey("bankCode"))
					document["bankCode"] = value;
					else document.Add("bankCode", value);
			}
		}
		
		/// \brief Common Email1 Extended attribute accessor
		public string Email1
		{
			get
			{
				if (document.ContainsKey("email"))
					return (string)document["email"];
				return "";
			}
			set
			{
				if (document.ContainsKey("email"))
					document["email"] = value;
					else document.Add("email", value);
			}
		}		
	}
}